/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service.inventory.impl;

import dao.inventory.UnitDao;
import java.util.List;
import model.inventory.Unit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import service.inventory.UnitService;

/**
 *
 * @author jay
 */
@Service("unitService")
@Transactional(readOnly=true)
public class UnitServiceImpl implements UnitService {
   
    @Autowired private UnitDao unitDao;

    @Transactional(readOnly=false)
    @Override
    public boolean save(Unit data) {
        return unitDao.save(data);
    }

    @Transactional(readOnly=false)
    @Override
    public boolean delete(Unit data) {
        return unitDao.delete(data);
    }

    @Override
    public Unit getUnit(int id) {
        return unitDao.getById(id);
    }

    @Override
    public List<Unit> getUnit() {
        return unitDao.getAll();
    }

    @Override
    public List<Unit> getUnit(int start, int num) {
        return unitDao.getAll(start, num);
    }

    @Override
    public List<Unit> getUnit(int start, int num, String params, String orderBy) {
        return unitDao.getAll(start, num, params, orderBy);
    }

    @Override
    public Unit getUnit(String kode) {
        return unitDao.getByKode("kode", kode);
    }

   
    
}
